#include "stdafx.h"
#include "3DTP.h"
#include <sstream>

#pragma comment (lib, "d3d9.lib")

FEngine::CoreEngine* engine;

// Entry point of the Windows program
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	try
	{
		engine = FEngine::CoreEngine::getInstance();
		if (!engine->initialize(hInstance, 1600, 800, Vector3(0, 0, 0)))
		{
			MessageBox(NULL, L"Error during the FEngine initialization", L"Error", 0);
			return false;
		}

		
		MainState* app = new MainState();
		engine->setApplication(app);
		engine->setCamera(new FEngine::Camera());
		
		engine->run();
		engine->cleanUp();
		FEngine::CoreEngine::deleteInstance();
	}
	catch (FEngine::FEngineException& e)
	{
	//	std::wstring stemp = std::wstring(e.getMessage().begin(), e.getMessage().end());
	//	LPCWSTR str = stemp.c_str();
		OutputDebugString(L"FEngineException");
		return false;
	}
	
    return 0;
}
